import { BasePaginationDto } from '@nbase/nest-mods';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsIn, IsInt, IsOptional, IsString, IsUUID } from 'class-validator';
import { DICT_STATUS_VALUES, IQueryDictData } from '@nbase/shared';
import { Type } from 'class-transformer';

/**
 * 查询字典数据 DTO
 */
export class QueryDictDataDto extends BasePaginationDto implements IQueryDictData {
  @ApiPropertyOptional({ description: '字典ID', example: '550e8400-e29b-41d4-a716-446655440000' })
  @IsOptional()
  @IsUUID()
  dictId?: string;

  @ApiPropertyOptional({
    description: '标签关键词',
    example: '启用',
  })
  @IsOptional()
  @IsString()
  label?: string;

  @ApiPropertyOptional({
    description: '值',
    example: '值',
  })
  @IsOptional()
  @IsString()
  value?: string;

  @ApiPropertyOptional({
    description: '状态（1.启用 2.禁用）',
    example: 1,
    enum: DICT_STATUS_VALUES,
  })
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @IsIn(DICT_STATUS_VALUES)
  status?: number;
}

